package vma.nicici.chat.communication;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URISyntaxException;
import java.util.List;

import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.impl.client.DefaultHttpClient;

public class PostHttpRequest extends HttpRequest{

	public PostHttpRequest(String url, List<? extends NameValuePair> parameters) {
		super(url, parameters, new HttpPost());
	}
	
	@Override
	public String getStringResponse() throws IOException, URISyntaxException {
		return send(url);
	}


	@Override
	public void clientPreparation(HttpRequestBase type)  {
		try {
			((HttpPost)type).setEntity(new UrlEncodedFormEntity(httpParams));
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
	}

}
